<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="lay/css/layui.css" media="all">
    <script src="../js/jquery-3.5.1.js"></script>
    <script src="../layui/layui.js"></script>
    <script src="../js/getUrlParam.js"></script>
</head>
<body>
  <form type="post"></form>
  <script>
      $(document).ready(function () {
          var order_no = getUrlParam("order_no");
          $.ajax({
              url:"/address",
              type:"get",
              data:{"method":"findAddressByOrderNo","order_no":order_no},
              success:function (data) {
                  var result=eval("("+data+")")
                 var str = "<p><input name='id' value='"+result.id+"' type='hidden'/></p>";
                  str+="<input name='method' value='update' type='hidden'/>";
                 str+="<p><input name='user_id' value='"+result.user_id+"' type='hidden' /></p>"
                  str+="<p><input name='name' value='"+result.name+"' type='text'/></p>";
                  str+="<p><input name='shipping' value='"+result.shipping+"' type='text'/></p>";
                 str+="<p><input name='phone' value='"+result.phone+"' type='text'/></p>"
                  str+="<p><input value='修改' id='submit' type='submit'/></p>"
                  $("form").append(str);
              }
          })
          $(document).on("click","#submit",function (e) {
              e.preventDefault();
              var data = $("form").serialize();
              $.ajax({
                  url:"../address",
                  type: "post",
                  data:data,
                  success:function (result) {
                      alert(result)
                    // if(result=="修改成功"){
                    //     layer.msg(result)
                    //     var index=parent.layer.getFrameIndex(window.name);
                    //   parent.layer.close(index)
                    // }
                      window.close();
                  }
              })
          })
      })
  </script>
</body>
</html>